using System.Text.Json;
using Microsoft.Extensions.DependencyInjection;

namespace EasyDapr.Infrastructure.Attribute
{
    public static class Extensions
    {
        public static IMvcBuilder AddCustomControllers(this IServiceCollection services)
        {
            // 过滤器
            services.AddSingleton<ApiExceptionFilterAttribute>();
            // services.AddSingleton<ApiResponseFilterAttribute>();

            return services.AddControllers(config =>
            {
                config.Filters.AddService(typeof(ApiExceptionFilterAttribute));
                // config.Filters.AddService(typeof(ApiResponseFilterAttribute));
            });
        }
    }
}